package com.newly.center.business.api;

import cn.hutool.core.util.ObjectUtil;
import com.newly.api.business.feign.MessageClient;
import com.newly.center.business.service.MessageService;
import com.newly.common.base.constants.ServerUriConstant;
import com.newly.common.base.entity.R;
import com.newly.common.base.entity.business.Dto.MessageDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @anthor sbq
 * @date 2021/12/2 15:19
 */
@RestController
@RequestMapping(ServerUriConstant.NEWLY_BUSINESS_MESSAGE)
public class MessageController implements MessageClient {

    @Autowired
    private MessageService messageService;

    @Override
    public R getPage(MessageDto messageDto) {
        return R.ok(messageService.getPage(messageDto));
    }

    @Override
    public R changeStatus(Long[] ids) {
        if (ObjectUtil.isEmpty(ids))
            return R.fail("id不为空");
        this.messageService.changeStatus(ids);
        return R.ok();
    }
}
